package chloroform

import java.lang.String

/**
 * <p>
 * Created by IntelliJ IDEA.
 * User: zslajchrt
 * Date: Feb 20, 2011
 * Time: 10:14:19 PM
 */

@SerialVersionUID(1)
class RelativeClasspathResourceResolver(clazz: Class[_]) extends URLResourceResolver {
  def resolveURL(resource: String) = clazz.getResource(resource)
}

@SerialVersionUID(1)
class ClasspathResourceResolver(clazz: Class[_]) extends URLResourceResolver {
  def this() = this(null)

  def resolveURL(resource: String) = {
    val classLoader = if (clazz != null)
      clazz.getClassLoader
    else
      Thread.currentThread.getContextClassLoader
    classLoader.getResource(resource)
  }
}